CREATE TABLE [dbo].[DnnProduct_UserRoles]
(
[UserRoleID] [int] NOT NULL IDENTITY(1, 1),
[UserID] [int] NOT NULL,
[RoleID] [int] NOT NULL,
[ExpiryDate] [datetime] NULL,
[IsTrialUsed] [bit] NULL,
[EffectiveDate] [datetime] NULL,
[CreatedByUserID] [int] NULL,
[CreatedOnDate] [datetime] NULL,
[LastModifiedByUserID] [int] NULL,
[LastModifiedOnDate] [datetime] NULL,
[Status] [int] NOT NULL CONSTRAINT [DF_DnnProduct_UserRoles_Status] DEFAULT ((1)),
[IsOwner] [bit] NOT NULL CONSTRAINT [DF_DnnProduct_UserRoles_IsOwner] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_UserRoles] ADD CONSTRAINT [PK_DnnProduct_UserRoles] PRIMARY KEY CLUSTERED  ([UserRoleID]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_UserRoles] ON [dbo].[DnnProduct_UserRoles] ([RoleID]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_UserRoles_1] ON [dbo].[DnnProduct_UserRoles] ([UserID]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_UserRoles] WITH NOCHECK ADD CONSTRAINT [FK_DnnProduct_UserRoles_DnnProduct_Roles] FOREIGN KEY ([RoleID]) REFERENCES [dbo].[DnnProduct_Roles] ([RoleID]) ON DELETE CASCADE NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[DnnProduct_UserRoles] WITH NOCHECK ADD CONSTRAINT [FK_DnnProduct_UserRoles_DnnProduct_Users] FOREIGN KEY ([UserID]) REFERENCES [dbo].[DnnProduct_Users] ([UserID]) ON DELETE CASCADE NOT FOR REPLICATION
GO
